﻿function Loading() {
    $("#loading").removeClass("hide");
}
function CloseLoading() {
    $("#loading").addClass("hide");
}
//分页跳转
function skipPage() {
    Loading();
    var jsonparam = {};
    if ($('#ui-pager').data('json')) {
        jsonparam = $('#ui-pager').data('json');
    }
    var newurl = $('#ui-pager').data('url');

    if (newurl == undefined || typeof (newurl) === undefined) {
        newurl = window.location.href;
    }
    $.each(jsonparam, function (name, value) {
        newurl += newurl.indexOf("?") == -1 ? "?" : "&";
        newurl += name + "=" + value;
    });
    newurl += ((newurl.indexOf("?") == -1 ? "?" : "&") + "pageindex=" + $('#skipPage').val());
    var order = $("input[name='order']").val();
    var by = $("input[name='by']").val();
    $.ajax({
        type: 'get',
        url: newurl,
        data: $('form').serialize(),
        error: function () {
            //Ajax提交失败..
            mui.alert("提示", "服务器没有返回数据,请重试..");
        },
        success: function (html) {
            CloseLoading();
            $('#ui-pager').empty();
            $('#ui-pager').append(html);
            if (order != undefined) {
                var th = $("td[data-sort='" + order + "']");
                th.removeClass("sorting");
                th.addClass("sorting_" + by);
            }
        }
    });
}
